package com.xyx.uniplugin_bloodoxygen.datastructs;

public class Result {
    /**
     * 码
     */
    public int code;
    /**
     * 消息
     */
    public String message;
    /**
     * 数据
     */
    public Object data;

    /**
     * 成功
     * @param data 数据
     * @return 结果
     */
    public static Result success(Object data) {
        Result result = new Result();
        result.code = 0;
        result.data = data;
        return result;
    }
    /**
     * 失败
     * @param code 错误码
     * @param message 错误信息
     * @return 结果
     */
    public static Result fail(int code, String message) {
        Result result = new Result();
        result.code = code;
        result.message = message;
        result.data = null;
        return result;
    }
}
